package com.litong.litongjiaoyu.entity;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * @ClassName WebSocketUser
 * @Description 即时聊天用户类
 * @Author jingz
 * @Date 2020/1/29 12:44
 * @Version 1.0
 **/
public class WebSocketUser {
    /**
     * 用户ID（“即用户名”），手机号作为ID
     */
    private String phone;

    /**
     * 用户昵称，用于显示
     */
    private String userName;

    /**
     * 用户所在校区
     */
    private String campus;

    /**
     * 用户微信头像
     */
    private String avatarUrl;


    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getCampus() {
        return campus;
    }

    public void setCampus(String campus) {
        this.campus = campus;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    @Override
    public String toString() {
        return "WebSocketUser{" +
                "Phone='" + phone + '\'' +
                ", userName='" + userName + '\'' +
                ", campus='" + campus + '\'' +
                ", avatarUrl='" + avatarUrl + '\'' +
                '}';
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (!(o instanceof WebSocketUser)) return false;

        WebSocketUser that = (WebSocketUser) o;

        return new EqualsBuilder()
                .append(getPhone(), that.getPhone())
                .append(getUserName(), that.getUserName())
                .append(getCampus(), that.getCampus())
                .append(getAvatarUrl(), that.getAvatarUrl())
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(getPhone())
                .append(getUserName())
                .append(getCampus())
                .append(getAvatarUrl())
                .toHashCode();
    }
}
